package com.hefei.common.excepition;

import com.hefei.common.utils.R;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author caizhengjun
 * @date 2021/3/4 下午5:49
 */

@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R globalException(Exception e) {

        return R.fail().message(e.getMessage());
    }
}
